package main

import (
	"fmt"
	"goInAction/tree"
	"goInAction/tree/extends"
)

func main() {
	var root tree.Node
	root = tree.Node{Value: 3}
	root.Left = &tree.Node{}
	root.Right = &tree.Node{Value: 5, Left: nil, Right: nil}
	root.Right.Left = new(tree.Node)
	root.Left.Right = tree.CreateNode(2)

	nodes := []tree.Node{
		{Value: 3},
		{},
		{6, nil, &root},
	}
	//使用值传递是没有办法修改值的
	root.Right.Left.SetValue(3)
	root.Right.Left.Print()

	//使用应用传递修改变量的值
	root.Right.Left.SetValueByPoint(5)
	root.Right.Left.Print()

	fmt.Println(nodes)

	root.Print()

	root.Traverse()

	extendNode := extends.ExtendNode{Node: &root}
	extendNode.PostOrder()
}
